﻿using System;
using System.Collections;

using umbraco.cms.businesslogic.datatype;
using umbraco.interfaces;

namespace CreativeMinds.Umbraco.DataTypes.CultureInfoSelector {

	public class CultureInfoSelectorDataType : BaseDataType, IDataType {
		private IDataEditor editor;
		private IData baseData;
		private IDataPrevalue prevalueEditor;

		public override IDataEditor DataEditor {
			get {
				if (editor == null) {
					editor = new CultureInfoSelectorEditor(this.Data, new SortedList());
				}
				return editor;
			}
		}

		public override IData Data {
			get {
				if (baseData == null) {
					baseData = new DefaultData(this);
				}
				return baseData;
			}
		}
		public override Guid Id {
			get {
				return new Guid("175e79bf-4b2e-4ed3-b321-eec12a10e576");
			}
		}

		public override string DataTypeName {
			get {
				return "Language/Region selector";
			}
		}

		public override IDataPrevalue PrevalueEditor {
			get {
				if (prevalueEditor == null) {
					prevalueEditor = new DefaultPreValueEditor(this, false);
				}
				return prevalueEditor;
			}
		}
	}
}